package com.example.bikemanagerjava.common;

import lombok.Data;

@Data
public class Result {
    private Integer code;
    private String message;
    private Object data;

    public static  Result success(Object data) {
        Result response = new Result();
        response.setCode(200);
        response.setMessage("Success");
        response.setData(data);
        return response;
    }

    public static  Result success(String message,Object data) {
        Result response = new Result();
        response.setCode(200);
        response.setMessage(message);
        response.setData(data);
        return response;
    }

    public static Result success() {
        Result response = new Result();
        response.setCode(200);
        response.setMessage("Success");
        return response;
    }

    public static  Result success(String message) {
        Result response = new Result();
        response.setCode(204);
        response.setMessage(message);
        return response;
    }

    public static  Result error(Integer code, String message) {
        Result response = new Result();
        response.setCode(code);
        response.setMessage(message);
        return response;
    }

}
